<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>列表渲染</title>
    <script src="./vue.js"></script>
  </head>
  <body>
    <ul id="example-1">
      <li v-for="item in items" :key="item.message">
        {{ item.message }}
      </li>
    </ul>
    <ul id="example-1">
      <li v-for="(item, index) of items">
        {{ parentMessage }} - {{ index }} - {{ item.message }}
      </li>
    </ul>
    <!-- 用于对象 -->
    <ul id="v-for-object" class="demo">
      <li v-for="value in object">
        {{ value }}
      </li>    
    </ul>
    <div v-for="(value, name, index) in object">
      {{ index }}. {{ name }}: {{ value }}
    </div>
    <div v-for="item in items" v-bind:key="item.id">
      <!-- 内容 -->
    </div>
    <script>
      var example1 = new Vue({
        el: "#example-1",
        data: {
          items: [{ message: "Foo" }, { message: "Bar" }],
        },
      });
      var exampleObject = new Vue({
        el: "#v-for-object",
        data: {
          object: {
            title: "How to do lists in Vue",
            author: "Jane Doe",
            publishedAt: "2016-04-10",
          },
        },
      });
    </script>
  </body>
</html>
